import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '@/views/layout'
const Login = () => import('@/views/login')
const Detail = () => import('@/views/detail')
const User = () => import('@/views/user')
const Article = () => import('@/views/article')
const Hot = () => import('@/views/hot')
const Count = () => import('@/views/count')
const Search = () => import('@/views/search')
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    { path: '/login', component: Login },
    { path: '/detail/:id', component: Detail },
    { path: '/hot', component: Hot },
    { path: '/count', component: Count },
    { path: '/search', component: Search },
    {
      path: '/',
      component: Layout,
      redirect: '/article',
      children: [
        { path: '/article', component: Article },
        { path: '/user', component: User }
      ]
    }
  ]
})

export default router
